﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using BarcodeStandard;

namespace BarcodeStandardTests.Symbologies
{
    [TestClass]
    public class MSITests
    {
        [DataTestMethod]
        [DataRow("1234567890123", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001001101101001101101101001")]
        [DataRow("123456789012644", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001101101001001101001001001101001001101001001001001")]
        public void EncodeBarcodeMod10(string data, string expected)
        {
            Barcode _barcode = new()
            {
                EncodedType = Type.MsiMod10
            };
            _barcode.Encode(data);
            Assert.AreEqual(expected, _barcode.EncodedValue, $"{_barcode.EncodedType}");
        }

        [DataTestMethod]
        [DataRow("1234567890123", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001001101101001001001101001001001001001")]
        [DataRow("123456789012644", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001101101001001101001001001101001001101001001001001")]
        public void EncodeBarcodeMod11(string data, string expected)
        {
            Barcode _barcode = new()
            {
                EncodedType = Type.MsiMod11
            };
            _barcode.Encode(data);
            Assert.AreEqual(expected, _barcode.EncodedValue, $"{_barcode.EncodedType}");
        }

        [DataTestMethod]
        [DataRow("1234567890123", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001001101101001101101101001001001001001")]
        [DataRow("123456789012644", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001101101001001101001001001101001001101001001001001001101101001")]
        public void EncodeBarcode2Mod10(string data, string expected)
        {
            Barcode _barcode = new()
            {
                EncodedType = Type.Msi2Mod10
            };
            _barcode.Encode(data);
            Assert.AreEqual(expected, _barcode.EncodedValue, $"{_barcode.EncodedType}");
        }

        [DataTestMethod]
        [DataRow("1234567890123", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001001101101001001001101001001001001001101101001001")]
        [DataRow("123456789012644", "1101001001001101001001101001001001101101001101001001001101001101001101101001001101101101101001001001101001001101001001001001001001001101001001101001001101101001001101001001001101001001101001001001001001101101001")]
        public void EncodeBarcodeMod11Mod10(string data, string expected)
        {
            Barcode _barcode = new()
            {
                EncodedType = Type.MsiMod11Mod10
            };
            _barcode.Encode(data);
            Assert.AreEqual(expected, _barcode.EncodedValue, $"{_barcode.EncodedType}");
        }
    }
}
